<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
     /*
    自定义函数分类
    1.普通函数定义  function 函数名(参数){参数体}
    2.把函数赋值给变量，通过变量调用函数
    3.匿名函数
    */

   //1
   function sayHello(userName){
        alert("hello"+userName);
    }
    sayHello("zhangsan");

    //2
    var showAge = function(age){
        return str="年龄为"+age;//没有返回值会输出undefined
    }
    console.log(showAge(20));
    
</script>
</html>